/**
 * 首页图表！
 * 
 */

/**
 * 接待利用情况
 */
function f_initChart_xmys(){
	var url = webPath+"/module/home/HomePageAction.do"+"?method=getXmysCharts&code=0";
	//f_createChart_xmys
	var success = f_createChart_xmysNew;
	var option = top.getAjaxOption({url:url,success:success});
	$.ajax(option);
}

function f_createChart_xmysNew(msg) {
	
	msg = eval("("+msg+")");
	
	//console.log(msg)
	
	var dom = document.getElementById("container");
	var myChart = echarts.init(dom);
	var app = {};
	option = null;
	app.title = '折柱混合';
	
	option = {
			title : {
		        text: '接待利用统计',
		        x:'0%',
		        y:'1%'
		    },
	    tooltip: {
	        trigger: 'axis',
	        axisPointer: {
	            type: 'cross',
	            crossStyle: {
	                color: '#999'
	            }
	        }
	    },
	    toolbox: {
	        feature: {
	            dataView: {show: true, readOnly: false},
	            magicType: {show: true, type: ['line', 'bar']},
	            restore: {show: true},
	            saveAsImage: {show: true}
	        }
	    },
	    legend:{data:['接待利用次数']},
	    xAxis: [
	        {
	            type: 'category',
	            data: msg.xAxis,
	            axisPointer: {
	                type: 'shadow'
	            }
	        }
	    ],
	    yAxis: {},
	    series:  {
            name:'接待利用次数',
            type:'bar',
            data:msg.series
        },
	};
	;

	 myChart.setOption(option);
	if (option && typeof option === "object") {
	    myChart.setOption(option, true);
	}
}



/**
 * 利用目的统计
 * @returns
 */
function f_init_liYong(webPath){
	var url = webPath+"/module/home/HomePageAction.do"+"?method=getLiYongCharts";
	var success = f_createCharts_liyong;
	
	var option = top.getAjaxOption({url:url,success:success});
	
	$.ajax(option);
	
}



function f_createCharts_liyong(msg) {
	
	msg = eval("("+msg+")");
	
	//console.log(msg)
	
	var dom = document.getElementById("container");
	var myChart = echarts.init(dom);
	var app = {};
	option = null;
	app.title = '折柱混合';
	
	option = {
			title : {
		        text: '利用目的统计',
		        x:'0%',
		        y:'1%'
		    },
	    tooltip: {
	        trigger: 'axis',
	        axisPointer: {
	            type: 'cross',
	            crossStyle: {
	                color: '#999'
	            }
	        }
	    },
	    toolbox: {
	        feature: {
	            dataView: {show: true, readOnly: false},
	            magicType: {show: true, type: ['line', 'bar']},
	            restore: {show: true},
	            saveAsImage: {show: true}
	        }
	    },
	    legend: {
	        data:['经济建设','落实政策','社会保障','编史修志','工作考查','学术研究','宣传教育','其他']
	    },
	    xAxis: [
	        {
	            type: 'category',
	            data: msg.xAxis,
	            axisPointer: {
	                type: 'shadow'
	            }
	        }
	    ],
	    yAxis: {},
	    series: [
	        {
	            name:'经济建设',
	            type:'bar',
	            data:msg.echartJjjs
	        },
	        {
	            name:'落实政策',
	            type:'bar',
	            data:msg.echartLssh
	        },
	        {
	            name:'社会保障',
	            type:'bar',
	            data:msg.echartShbz
	        },
	        {
	            name:'编史修志',
	            type:'bar',
	            data:msg.echartBsxz
	        },
	        {
	            name:'工作考查',
	            type:'bar',
	            data:msg.echartGzkc
	        },
	        {
	            name:'学术研究',
	            type:'bar',
	            data:msg.echartXsyj
	        },
	        {
	            name:'宣传教育',
	            type:'bar',
	            data:msg.echartXcjx
	        },
	        {
	            name:'其他',
	            type:'bar',
	            data:msg.echartQt
	        }
	    ]
	};
	;

	 myChart.setOption(option);
	if (option && typeof option === "object") {
	    myChart.setOption(option, true);
	}
}



/**
 * 档案类型统计
 * @returns
 */
function f_init_type(webPath){
	var url = webPath+"/module/home/HomePageAction.do"+"?method=getTypeCharts";
	var success = f_createCharts_type;
	var option = top.getAjaxOption({url:url,success:success});
	$.ajax(option);
	
}

function f_createCharts_type(msg) {
	
	msg = eval("("+msg+")");
	
	var dom = document.getElementById("container");
	var myChart = echarts.init(dom);
	var app = {};
	option = null;
	
	option = {
		    title : {
		        text: '档案类型统计',
		        x:'0'
		    },
		    tooltip : {
		        trigger: 'item',
		        formatter: "{a} <br/>{b} : {c} ({d}%)"
		      
		    },
		    legend: {
		    	type:'scroll',
		        orient: 'vertical',
		        left: '9%',
		        //data: ['文书档案库', '民生档案库', '民国档案', '实物档案库', '文书档案', '公证档案', '会计档案', '锡山档案1', '锡山档案管', '图书资料库'],
		        data: (function (){
		            var list = [];
		            for (var i = 0; i <msg.type.length; i++) {
		                list.push(msg.type[i]);
		            }
		            return list;
		        })()
		    },
		    series : [
		        {
		            name: '数据来源',
		            type: 'pie',
		            radius : '70%',
		            center: ['50%', '40%'],
		            data:(function (){
			            var list = [];
			            for (var i = 0; i <msg.type.length; i++) {
			            	list.push({
			            		value: 1,
			                    name: msg.type[i]
			                });
			            }
			            
			            return list;
			        })(),
		            itemStyle: {
		                emphasis: {
		                    shadowBlur: 100,
		                    shadowOffsetX: 0,
		                    shadowColor: 'rgba(0, 0, 0, 0.5)'
		                }
		            }
		        }
		    ]
		};
	
	
	myChart.setOption(option);
	if (option && typeof option === "object") {
	    myChart.setOption(option, true);
	}
}


/**
 * 全宗类型统计
 */
function f_init_quanzong(webPath, type){
	
	
	
	var url = webPath+"/module/home/HomePageAction.do"+"?method=getQuzongCharts&type="+type;
	var success = f_createChart_quzong;
	var option = top.getAjaxOption({url:url,success:success});
	$.ajax(option);
}

function f_createChart_quzong(msg) {
	
	
	
		
		msg = eval("("+msg+")");
		if(msg.xAxis.length==0){
			alert("暂无数据！！")
		}else{
	
	var dom = document.getElementById("container");
	var myChart = echarts.init(dom);
	var app = {};
	option = null;
	
	option = {
			title : {
		        text: '文书全宗类型统计',
		        x:'0%',
		        y:'6%'
		    },
		    tooltip : {
		        trigger: 'item',
		        formatter: "{a}: {b} <br/>年度个数: {c} ({d}%)"
		        //formatter:(function (s){
		        //	console.log(s)
		        //   var list = "";
		        //    for (var i = 0; i <msg.ndArr.length; i++) {
		        //        list = msg.ndArr[i];
		         //   }
		         //   return list;
		        //})
		    },
		    legend: {
		    	type:'scroll',
		        orient: 'vertical',
		        right: '5%',
		        data: (function (){
		            var list = [];
		            for (var i = 0; i <msg.xAxis.length; i++) {
		                list.push(msg.xAxis[i]);
		            }
		            return list;
		        })()
		    },
		    series : [
		        {
		            name: '数据来源',
		            type: 'pie',
		            radius : '66%',
		            center: ['35%', '55%'],
		            data:(function (){
			            var list = [];
			            for (var i = 0; i <msg.xAxis.length; i++) {
			            	list.push({
			            		//value: msg.ndArr[i],
			            		value: msg.y[i],
			                    name: msg.xAxis[i]
			                });
			            }
			            
			            return list;
			        })(),
		            itemStyle: {
		                emphasis: {
		                    shadowBlur: 100,
		                    shadowOffsetX: 0,
		                    shadowColor: 'rgba(0, 0, 0, 0.5)'
		                }
		            }
		        }
		    ]
		};
	
	
	myChart.setOption(option);
	if (option && typeof option === "object") {
	    myChart.setOption(option, true);
	}
		}
}



/**
 * 档案数据类型统计
 */
function f_init_arInfo(webPath){
	var url = webPath+"/module/home/HomePageAction.do"+"?method=seeAllData";
	var success = f_createChart_arInfo;
	var option = top.getAjaxOption({url:url,success:success});
	$.ajax(option);
}



/**
 * 库房温度统计
 */
function f_initChart_temperature1(year){
	
	alert(year);
	var CURRENT_ACTION = webPath+"/module/home/HomePageAction.do";
	var url = CURRENT_ACTION+"?method=getTemperatureCharts&year=2017";
	var success = f_createChart_temperature;
	var option = top.getAjaxOption({url:url,success:success});
	$.ajax(option);
}
/**
 * 库房湿度统计
 */
function f_initChart_humidity1(year){
	alert(year);
	var CURRENT_ACTION = webPath+"/module/home/HomePageAction.do";
	var url = CURRENT_ACTION+"?method=getHumidityCharts&year="+year;
	var success = f_createChart_humidity;
	var option = top.getAjaxOption({url:url,success:success});
	$.ajax(option);
}
/**
 * 库房台账
 * @return
 */
function f_storage_Chart(path){
	if(!$("#BG1647")[0]) return;
	var url = path+"/module/home/HomePageAction.do?method=getStorageArCharts";
	var success = f_InitStorage_Chart;
	var option = getAjaxOption({url:encodeURI(url),success:success});
	$.ajax(option);
}

/**
 * 库房台账
 * @return
 */
function f_InitStorage_Chart(msg){
	if(msg == "0") return;
	msg = eval("("+msg+")");
	
	if(msg[msg.length-1].length==0){
		$("#BG1647").html("<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>暂无数据！</span>");
		return;
	}
	var param = {
    	path:webPath,//项目路径
    	magicType:[echartsTool.magicType[1]],//数据展示图形类型如：柱状图、折线图、饼图等
    	theme:echartsTool.theme[13],//主题
    	main:"BG1647"//页面DIV_ID
    };
	
	var timelineArr = new Array();
	for(var i=0; i<msg[msg.length-1].length; i++){
		var tmp = "0000" + msg[msg.length-1][i];
		timelineArr[i] = tmp.substr(tmp.length-4, 4); 
	}
	var option = {
			timeline : {
			    data : timelineArr,
			    label : {
			        formatter : function(s) {
						var rtn = "";
						for(var i=0; i<msg[msg.length-1].length; i++){
							if(parseInt(s)==parseInt(msg[msg.length-1][i])){
								eval("rtn = msg[msg.length-2][" + i + "]");
								break;
							}
						}
						return rtn;
			        }
			    },
			    show : true,//显示策略
			    notMerge : true,//是否进行刷新操作，时间轴上多个option切换时是否进行merge操作，同setOption第二个参数
			    autoPlay : true,playInterval : 4000
			},
			options : []
	};
	
	for(var i=0; i<msg[msg.length-2].length; i++){
		var storeName = msg[msg.length-2][i];
		option.options[i] = {
			  	title : {text: "			【" + storeName + '】档案存量统计',subtext: ''},
	  			tooltip : {trigger: 'axis'},
	  			legend: {data:['库房档案存量统计']},
	  			toolbox: {
	  				show : true,
	  				feature : {
	  					mark : {show: true},
	  					dataView : {show: true, readOnly: false},
	  					magicType : {show: true, type: ['bar']},
	  					restore : {show: true},
	  					saveAsImage : {show: true}
	  				}
	  			},
	  			calculable : true,
	  			grid : {'y':100,'y2':100, 'x':100,'x2':100},
	  			xAxis : [{type : 'category',data : msg[i][0]}],
	  			yAxis : [{type : 'value'}],
	  			series : [
	  			     {
	  			    	name:'库房档案存量统计',
	  			    	type:'bar',
	  			    	barWidth: 40,
	  			    	data:msg[i][1],
	  			    	itemStyle:{normal:{label:{show:true}}},
	  			    	markPoint : {
	  			    	 	data : [{type : 'max', name: '最大值'},{type : 'min', name: '最小值'}]
	  			     	},
	  			     	markLine : {
	  			     		data : [{type : 'average', name: '平均值'}]
	  			     	}
	  			     }
	  			]
		};
	}
	
	param.option = option;
    echartsTool.createECharts(param);                   
}

/**
 * 库房台账
 * @return
 */
function f_InitStorage_Chart1(msg){
	if(msg == "0") return;
	msg = eval("("+msg+")");
	
	var param = {
    	path:webPath,//项目路径
    	magicType:[echartsTool.magicType[4]],//数据展示图形类型如：柱状图、折线图、饼图等
    	theme:echartsTool.theme[13],//主题
    	main:"BG1647"//页面DIV_ID
    };
	
	var timelineArr = new Array();
	for(var i=0; i<msg[msg.length-2].length; i++){
		var tmp = "0000" + msg[msg.length-2][i];
		timelineArr[i] = tmp.substr(tmp.length-4, 4); 
	}
	
	var idx = 1;
	var option = {
	    timeline : {
			data : timelineArr,//msg[msg.length-2],
	        /*data : [
	            '2013-01-01', '2013-02-01', '2013-03-01', '2013-04-01', '2013-05-01',
	            { name:'2013-06-01', symbol:'emptyStar6', symbolSize:8 },
	            '2013-07-01', '2013-08-01', '2013-09-01', '2013-10-01', '2013-11-01',
	            { name:'2013-12-01', symbol:'star6', symbolSize:8 }
	        ],*/
	        label : {
	            formatter : function(s) {
					for(var i=0; i<msg[msg.length-2].length; i++){
						if(parseInt(s)==parseInt(msg[msg.length-2][i])){
							eval("var rtn = msg[msg.length-3][" + i + "]");
							break;
						}
					}
					return rtn;
	                //return s.slice(0, 7);
	            }
	        },
	        autoPlay : true,playInterval : 5000
	    },
	    options : [
	        {
	            title : {
	                text: '',
	                subtext: ''
	            },
	            tooltip : {
	                trigger: 'item',
	                formatter: "{a} <br/>{b} : {c} ({d}%)"
	            },
	            legend: {
	                //data:['Chrome','Firefox','Safari','IE9+','IE8-'],
	            	data:msg[msg.length-1],
	              	x:'left',
	              	orient : 'vertical'
	            },
	            toolbox: {
	                show : true,
	                feature : {
	                    mark : {show: true},
	                    dataView : {show: true, readOnly: false},
	                    magicType : {
	                        show: true, 
	                        type: ['pie', 'funnel'],
	                        option: {
	                            funnel: {
	                                x: '25%',
	                                width: '50%',
	                                funnelAlign: 'left',
	                                max: 1700
	                            }
	                        }
	                    },
	                    restore : {show: true},
	                    saveAsImage : {show: true}
	                }
	            },
	            series : [
	                {
	                    name:'',
	                    type:'pie',
	                    center: ['50%', '45%'],
	                    radius: '50%',
	                    data:msg[0]
	                }
	            ]
	        }
	    ]
	};
	  
	for(var i=1; i<msg[msg.length-2].length; i++){
		option.options[i] = {
			series:[{
				name:'',
                type:'pie',
				data:msg[i]
			}]         
		};
	}
	param.option = option;
    echartsTool.createECharts(param);
}

/**
 * 登陆后档案利用情况
 */
function f_initArUse_Chart(num){
	//var parmStr = "文书案卷:00W1,文书文件:00W2,文书一文一件:00W3,照片档案:0T24";
	var url = top.CURRENT_ACTION+"?method=getArUseCharts&parmStr="+top.ITool.lyparmStr+"&num="+num;
	var success = f_setArUse_Chart;
	var option = top.getAjaxOption({url:encodeURI(url),success:success});
	$.ajax(option);
	
	//f_setArUse_Chart("1");
}

/**
 * 登陆后档案利用情况
 */
function f_setArUse_Chart(msg){
	if(msg == "0") return;
	msg = eval("("+msg+")");
	
	var param = {
    	path:webPath,//项目路径
    	magicType:[echartsTool.magicType[4]],//数据展示图形类型如：柱状图、折线图、饼图等
    	theme:echartsTool.theme[13],//主题
    	main:"main_lys"//页面DIV_ID
    };
	
	var idx = 1;
	var option = {
	    timeline : {
			data : msg[msg.length-1],
	        /*data : [
	            '2013-01-01', '2013-02-01', '2013-03-01', '2013-04-01', '2013-05-01',
	            { name:'2013-06-01', symbol:'emptyStar6', symbolSize:8 },
	            '2013-07-01', '2013-08-01', '2013-09-01', '2013-10-01', '2013-11-01',
	            { name:'2013-12-01', symbol:'star6', symbolSize:8 }
	        ],*/
	        label : {
	            formatter : function(s) {
	                return s.slice(0, 7);
	            }
	        },
	        autoPlay : true,playInterval : 4000
	    },
	    options : [
	        {
	            title : {
	                text: '',
	                subtext: ''
	            },
	            tooltip : {
	                trigger: 'item',
	                formatter: "{a} <br/>{b} : {c} ({d}%)"
	            },
	            legend: {
	                //data:['Chrome','Firefox','Safari','IE9+','IE8-'],
	            	data:msg[msg.length-2],
	              	x:'left',
	              	orient : 'vertical'
	            },
	            toolbox: {
	                show : true,
	                feature : {
	                    mark : {show: true},
	                    dataView : {show: true, readOnly: false},
	                    magicType : {
	                        show: true, 
	                        type: ['pie'],
	                        option: {
	                            funnel: {
	                                x: '25%',
	                                width: '50%',
	                                funnelAlign: 'left',
	                                max: 1700
	                            }
	                        }
	                    },
	                    restore : {show: true},
	                    saveAsImage : {show: true}
	                }
	            },
	            series : [
	                {
	                    name:'',
	                    type:'pie',
	                    center: ['50%', '45%'],
	                    radius: '50%',
	                    data:msg[0]
	                }
	            ]
	        }
	    ]
	};
	  
	for(var i=1; i<msg[msg.length-1].length; i++){
		option.options[i] = {
			series:[{
				name:'',
                type:'pie',
				data:msg[i]
			}]         
		};
	}
	param.option = option;
    echartsTool.createECharts(param);
}
/**
 * 接待利用情况
 * @param {Object} msg
 */
function f_createChart_xmys(msg){
	
	
	if(msg != "0"){
		msg = eval("("+msg+")");
		if(msg.series.length==0){
			$("#main_xmys").html("<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>暂无数据！</span>");
			return;
		}
		var param = {
	    	path:webPath,//项目路径
	    	magicType:[echartsTool.magicType[0],echartsTool.magicType[1]],//数据展示图形类型如：柱状图、折线图、饼图等
	    	theme:echartsTool.theme[3],//主题
	    	main:"main_xmys",//页面DIV_ID
	    	click:null,//点击时执行的方法
	    	title:{text:"",subtext:""},
	    	legend:{data:['接待利用次数']},
	    	feature:{dataZoom:{show:false}},
	    	xAxis:{type:"category",data:msg.xAxis},
	    	//xAxis:{type:"category",data:[1,2]},
	    	series:[{data:msg.series,markPoint:false,markLine:true,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}}]
	    	//series:[{data:[1,29],markPoint:false,markLine:true,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}}]
	    };
	    echartsTool.createECharts(param);
	}
}
/**
 * 库房温度统计
 * @param {Object} msg
 */
function f_createChart_temperature(msg){
	if(msg != "0"){
		msg = eval("("+msg+")");
		if(msg.series.length==0){
			$("#main_xmys").html("<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>暂无数据！</span>");
			return;
		}
		var param = {
	    	path:webPath,//项目路径
	    	magicType:[echartsTool.magicType[0],echartsTool.magicType[1]],//数据展示图形类型如：柱状图、折线图、饼图等
	    	theme:echartsTool.theme[3],//主题
	    	main:"main_xmys",//页面DIV_ID
	    	click:null,//点击时执行的方法
	    	title:{text:"",subtext:""},
	    	legend:{data:['温度 统计']},
	    	feature:{dataZoom:{show:false}},
	    	xAxis:{type:"category",data:msg.xAxis},
	    	//xAxis:{type:"category",data:[1,2]},
	    	series:[{data:msg.series,markPoint:false,markLine:true,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}}]
	    	//series:[{data:[1,29],markPoint:false,markLine:true,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}}]
	    };
	    echartsTool.createECharts(param);
	}
}
/**
 * 库房湿度统计
 * @param {Object} msg
 */
function f_createChart_humidity(msg){
	if(msg != "0"){
		msg = eval("("+msg+")");
		if(msg.series.length==0){
			$("#main_das").html("<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>暂无数据！</span>");
			return;
		}
		var param = {
	    	path:webPath,//项目路径
	    	magicType:[echartsTool.magicType[0],echartsTool.magicType[1]],//数据展示图形类型如：柱状图、折线图、饼图等
	    	theme:echartsTool.theme[3],//主题
	    	main:"main_das",//页面DIV_ID
	    	click:null,//点击时执行的方法
	    	title:{text:"",subtext:""},
	    	legend:{data:['湿度统计']},
	    	feature:{dataZoom:{show:false}},
	    	xAxis:{type:"category",data:msg.xAxis},
	    	//xAxis:{type:"category",data:[1,2]},
	    	series:[{data:msg.series,markPoint:false,markLine:true,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}}]
	    	//series:[{data:[1,29],markPoint:false,markLine:true,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}}]
	    };
	    echartsTool.createECharts(param);
	}
}
/**
 * 馆里档案存档数
 * @param {Object} year       当前年份 
 * @param {Object} beforYear  前多少年
 */
function f_initChart_das(afterYear){
	var url = top.CURRENT_ACTION+"?method=getDaqkCharts&parmStr="+top.ITool.gctjparmStr;
	var success = f_createChart_arInfo;
	var option = top.getAjaxOption({url:encodeURI(url),success:success});
	$.ajax(option);
}
/**
 * 档案类型数据统计
 */
function f_createChart_arInfo(msg){
	
	if(msg != "0"){
		msg = eval("("+msg+")");
		var param = {
	    	path:webPath,//项目路径
	    	magicType:[echartsTool.magicType[0],echartsTool.magicType[1]],//数据展示图形类型如：柱状图、折线图、饼图等
	    	theme:echartsTool.theme[3],//主题
	    	main:"main_das"//页面DIV_ID
	    };
		var option = {
	            title : {
	                text: '',
	                subtext: ''
	            },
			    tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
			    legend: {
			    	x: 'left',
			        //data:['直接访问', '邮件营销','联盟广告','视频广告','搜索引擎']
			        data:msg[msg.length-1]
			    },
			    toolbox: {
			        show : true,
			        feature : {
			            mark : {show: true},
			            dataView : {show: true, readOnly: false},
			            magicType : {show: true, type: ['line', 'bar']},
			            restore : {show: true},
			            saveAsImage : {show: true}
			        }
			    },
			    calculable : true,
			    xAxis : [
			        {
			            type : 'value'
			        }
			    ],
			    yAxis : [
			        {
			            type : 'category',
			            //data : ['周一','周二','周三','周四','周五','周六','周日']
			            data : msg[msg.length-2]
			        }
			    ]/*,
			    series : [
			        {
			            name:'永久',
			            type:'bar',
			            stack: '总量',
			            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
			            data:[320, 302, 301]
			        },
			        {
			            name:'长期',
			            type:'bar',
			            stack: '总量',
			            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
			            data:[120, 132, 101]
			        },
			        {
			            name:'短期',
			            type:'bar',
			            stack: '总量',
			            itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
			            data:[220, 182, 191]
			        }
			    ]*/
			};
		
		var series = new Array();
		/*for(var i=0; i<msg[msg.length-1].length; i++){
			var detail = new Array();
			for(var j=0; j<msg[msg.length-2].length; j++){
				detail[j] = msg[i][j].value;
			}
			series[i] = {
				name:msg[msg.length-1][i],
				type:'bar',
		     	stack: '总量',
		     	itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
		     	data:detail
			}
		}*/
		var dataArr = new Array();
		for(var i=0; i<msg[msg.length-1].length; i++){
			var dataArri = new Array();
			for(var j=0; j<msg[msg.length-2].length; j++){
				var detial = msg[0][j];
				eval("var valObj = detial." + msg[msg.length-2][j]);
				dataArri[j] = valObj[i].SUM;
			}  
			series[i] = {
					name:msg[msg.length-1][i],
					type:'bar',
			     	stack: '总量',
			     	itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
			     	data:dataArri
				};
		}
		option.series = series;
		param.option = option;
	    echartsTool.createECharts(param);
	}
}

/**
 * 馆里档案存档数图表
 * @param {Object} msg
 */
function f_createChart_das(msg){
	if(msg != "0"){
		//alert("msg="+msg);
		msg = eval("("+msg+")");
		msg[msg.length-1] = [2001,2002,2003];
		var param = {
	    	path:webPath,//项目路径
	    	magicType:[echartsTool.magicType[4]],//数据展示图形类型如：柱状图、折线图、饼图等
	    	theme:echartsTool.theme[13],//主题
	    	main:"main_das"//页面DIV_ID
	    };
	var	option = {
	    timeline : {data :msg[msg.length-1],autoPlay : true,playInterval : 5000},
	    options : [{
	        title : {text: '',subtext: '', x:'left',y:"top"},
		    tooltip : {trigger: 'item',formatter: "{a} <br/>{b} : {c} ({d}%)"},
		    legend: {orient : 'vertical',x : 'left',data:msg[msg.length-2]
		    	},
		    toolbox: {
		    	show : true,
		        feature : {
		    		mark : {show: true},
		            dataView : {show: true, readOnly: false},
		            magicType : {
		            	show: true, 
		            	type: [echartsTool.magicType[4]],
		                option: {funnel: {x: '25%',width: '50%',funnelAlign: 'left',max: 1548}}
		            },
		            restore : {show: true},
		            saveAsImage : {show: true}
		        }
		    },
		    calculable : true,
            series : [
                {
                    name:msg[msg.length-1][0],
                    type:echartsTool.magicType[4],
                    center: ['50%', '45%'],
                    radius: '50%',
                    data:msg[0],
                    itemStyle:{normal:{label:{show:true
		            	,position:"top",formatter:"{d}%"}}},
		            minAngle:100
                }
            	]
	        }  
		    ]
		};
		
		for(var i=1;i<msg.length-2; i++){
			option.options[i] = {
				 series : [{
					 name:msg[msg.length-1][i],
					 type:echartsTool.magicType[4],
					 data:msg[i],center: ['50%', '45%'],radius: '50%',
					 itemStyle:{normal:{label:{show:true
		            	,position:"top",formatter:"{d}%"}}},
		            minAngle:100
					}]
			};
		}
		param.option = option;
	    echartsTool.createECharts(param);
	}
}


/**
 * 获取项目验收情况图表必要数据 并生成图表
 */
function f_initChart_lys(year,beforMonth){
	var url = top.CURRENT_ACTION+"?method=getLysCharts&year="+year+"&beforMonth="+beforMonth;
	var success = f_createChart_lys;
	var option = top.getAjaxOption({url:url,success:success});
	$.ajax(option);
}
/**
 * 创建项目验收情况图表
 * @param {Object} msg
 */
function f_createChart_lys(msg){
	if(msg != "0"){
		msg = eval("("+msg+")");
		var param = {
	    	path:webPath,//项目路径
	    	magicType:[echartsTool.magicType[0],echartsTool.magicType[1]],//数据展示图形类型如：柱状图、折线图、饼图等
	    	theme:echartsTool.theme[13],//主题
	    	main:"main_lys",//页面DIV_ID
	    	click:null,//点击时执行的方法
	    	title:{text:"",subtext:""},
	    	legend:{data:msg.name,x:"left"},
	    	grid:{x:55,x2:55,y:50,y2:30},
	    	feature:{dataZoom:{show:false}},
	    	xAxis:{type:"category",data:msg.x},
	    	series:[{data:msg.value[0],markPoint:false,markLine:false,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}},
	    		    {data:msg.value[1],markPoint:false,markLine:false,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}},
	    		    {data:msg.value[2],markPoint:false,markLine:false,itemStyle:{normal:{label:{show:true,position:"top",formatter:"{c}"}}}}]
	    };
	    echartsTool.createECharts(param);
	}

}